package com.panorama.visitor.test_nodes;

import com.panorama.visitor.annotation.Visitable;

public class AddExpression extends Expression {
	@Visitable
	private Expression left;
	
	@Visitable
	private Expression right;
	
	public AddExpression() {
		super();
	}

	public AddExpression(Expression left, Expression right) {
		super();
		this.left = left;
		this.right = right;
	}

	@Override
	public void typeCheck() {
		if(left.getType().equals(right.getType())) {
			setType(left.getType());
		} else {
			throw new Error("Type of left subexpression does not match type of right sub expression.");
		}
	}

	/**
	 * @return the left
	 */
	public Expression getLeft() {
		return left;
	}

	/**
	 * @param left the left to set
	 */
	public void setLeft(Expression left) {
		this.left = left;
	}

	/**
	 * @return the right
	 */
	public Expression getRight() {
		return right;
	}

	/**
	 * @param right the right to set
	 */
	public void setRight(Expression right) {
		this.right = right;
	}
	
	

}
